package com.test.tiles.util;

import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;

import com.test.tiles.model.vo.UserVo;


@Scope(value = "session", proxyMode=ScopedProxyMode.TARGET_CLASS)
@Component("sessionUtil")
public class SessionUtil {
	private UserVo user;
    private static UserVo static_user;
    private String rUrl;

	/*
     * user ���� ��ȸ
    */
    public UserVo getUser() {
        if(user == null) user = new UserVo();
        return user;
    }
    
    public static String getUserID(){
    	if(static_user == null) static_user = new UserVo();
    	return static_user.getUser_id();
    }

    /*
     * user ���� ����
    */
    public void setUser(UserVo user) {
        this.user = user;
    }
    
    /*
     * ����ڰ� �α��εǾ� �ִ� �������� Ȯ��
    */
    public boolean isLoginYN(){
    	if (getUser().getUser_id() != null){
    		return true;
    	}else{
    		return false;
    	}
    }
    
    /*
     * session void ó��
    */
    public void sessionVoid(){
    	setUser(null);
    	setrUrl(null);
    }
    
	/*
     * Return URL ���� ��ȸ
    */
    public String getrUrl() {
		return rUrl;
	}

	/*
     * Return URL ���� ����
    */
	public void setrUrl(String rUrl) {
		this.rUrl = rUrl;
	}
}
